#!/bin/sh

set -e

USER=krakend

if ! getent passwd $USER >/dev/null ; then
  adduser --system --disabled-login --gecos "KrakenD" --shell /bin/false --no-create-home $USER > /dev/null
fi

if [ -x "/etc/init.d/krakend" ] || [ -e "/etc/init/krakend.conf" ]; then
	service krakend stop || exit $?
fi
